<?php
/**
 * @package WordPress
 * @subpackage P2
 */
?>
<li id="prologue-<?php the_ID(); ?>" <?php post_class(); ?>>
	<?php

	/**
	 * POST META
	 */

	if ( ! is_page() ):
		$author_posts_url = get_author_posts_url( get_the_author_meta('ID') );
		$posts_by_title   = sprintf(
			__( 'Posts by %1$s ( @%2$s )', 'p2' ),
			get_the_author_meta( 'display_name' ),
			get_the_author_meta( 'user_nicename' )
		); ?>

		<a href="<?php echo esc_attr( $author_posts_url ); ?>" title="<?php echo esc_attr( $posts_by_title ); ?>">
			<?php echo get_avatar( get_the_author_meta('ID'), 48 ); ?>
		</a>
	<?php endif; ?>
	<h4>
		<?php if ( ! is_page() ): ?>
			<a href="<?php echo esc_attr( $author_posts_url ); ?>" title="<?php echo esc_attr( $posts_by_title ); ?>"><?php the_author(); ?></a>
		<?php endif; ?>
		<span class="meta">
			<?php
			if ( ! is_page() ) {
				echo p2_date_time_with_microformat();
			} ?>
			
			<?php if ( ! is_page() ) : ?>
				<span class="tags">
					<?php tags_with_count( '', __( '<br />标签:' , 'p2' ) .' ', ', ', ' &nbsp;' ); ?>&nbsp;
				</span>
			<?php endif; ?>
		</span>
	</h4>

	<?php
	/**
	 * CONTENT
	 */
	?>

	<div id="content-<?php the_ID(); ?>" class="postcontent">
		<?php
		if ( 'status' == p2_get_the_category() || 'link' == p2_get_the_category() ) :
			p2_title();
			the_content( __( '(More ...)' , 'p2' ) );

		elseif ( 'quote' == p2_get_the_category() ) :
			echo "<blockquote>";
			p2_quote_content();
			echo "</blockquote>";

		elseif ( 'post' == p2_get_the_category() ) :
			p2_title();
			the_content( __( '(More ...)' , 'p2' ) );

		else :
			p2_title();
			the_content( __( '(More ...)' , 'p2' ) );

		endif; ?>
	</div>

	<?php
	/**
	 * COMMENTS
	 */

	$comment_field = '<div class="form"><textarea id="comment" class="expand50-100" name="comment" cols="45" rows="3"></textarea></div> <label class="post-error" for="comment" id="commenttext_error"></label>';

	$comment_notes_before = '<p class="comment-notes">未登录的童鞋需要填写网名和邮箱才可评论。可以通过微博直接登录。</p>';

	$comment_notes_after = sprintf(
		'<span class="progress"><img src="%1$s" alt="%2$s" title="%2$s" /></span>',
		str_replace( WP_CONTENT_DIR, content_url(), locate_template( array( "i/indicator.gif" ) ) ),
		esc_attr( 'Loading...', 'p2' )
	);

	$p2_comment_args = array(
		'title_reply'           => __( 'Reply', 'p2' ),
		'comment_field'         => $comment_field,
		'comment_notes_before'  => $comment_notes_before,
		'comment_notes_after'   => $comment_notes_after,
		'label_submit'          => __( 'Reply', 'p2' ),
		'id_submit'             => 'comment-submit',
	);

	?>

	<div class="feishi_action">
		<div class="feishi_action_rate">
			<!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share?uid=1552616" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript">var jiathis_config = {data_track_clickback:true};</script>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js?uid=1552616" charset="utf-8"></script>
<!-- JiaThis Button END -->
		</div> <!-- feishi_action_rate -->
		<div class="discussion">
				<a href="javascript:void(0)" class="toggle-comments" id="<?php echo get_the_ID(); ?>"><?php echo get_comments_number(); ?></a>
		</div>
		<div class="feishi_action_detail">
			<a href="<?php the_permalink(); ?>" class="thepermalink"></a>
		</div> <!-- feishi_action_detail -->

	</div> <!-- feishi_action -->
	<?php wp_link_pages( array( 'before' => '<p class="page-nav">' . __( 'Pages:', 'p2' ) ) ); ?>

	<div class="bottom-of-entry">&nbsp;</div>

	<?php
	if ( ! p2_is_ajax_request() ) : ?>
		<div class="show-comments-<?php echo get_the_ID(); ?>" <?php echo ( ! is_singular() ) ? 'style="display: none; "' : ''; ?>>
			<div class="respond-wrap">
				<?php comment_form( $p2_comment_args ); ?>
			</div>
			<?php comments_template(); ?>
		</div><!-- show-comments -->
		
		<?php 
		$pc = 0;
		if ( p2_show_comment_form() && $pc == 0 && ! post_password_required() ) :
			$pc++; ?>
			<?php
		endif;
	endif; ?>
</li>
